Skip to content

Remove private constructor for Printer #1747

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Conversation

ruudk
Copy link
Contributor

@ruudk ruudk commented Aug 12, 2025

The Printer is not stateful. So enforcing a singleton serves no purpose (anymore?).

We can easily use new Printer()->printAST($node).

The Printer is not stateful. So enforcing a singleton serves no purpose (anymore?).

We can easily use `new Printer()->printAST($node)`.
@spawnia
Copy link
Collaborator

spawnia commented Aug 12, 2025

Why instantiate the Printer in the first place?

@ruudk
Copy link
Contributor Author

ruudk commented Aug 12, 2025

Well, it is instantiated, and then statically cached. To me, there is no point in doing this. What was the reason for that?

@spawnia
Copy link
Collaborator

spawnia commented Aug 12, 2025

I would rather make the class completely static then to invite superfluous instantiations.

@ruudk
Copy link
Contributor Author

ruudk commented Aug 13, 2025

Alright, not worth it as it's a BC break.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants